<template>
	<view class="contain">
		<view class="header">
			<view class="search">
				<view class="text">
					<image class="img" src="../../static/position.png"></image>
					<text>上海</text>
				</view>
				<view class="input">
					<u-search placeholder="大家都在搜索代理记账" v-model="searchWord" bg-color="#fff" clearabled :show-action="false"></u-search>
				</view>
			</view>
			<view class="tab">
				<u-tabs
				:list="list"
				:is-scroll="true"
				:current="current"
				@change="change"
				font-size="26"
				bg-color="#409EFF"
				:bar-width="barWidth"
				bar-height="8"
				inactive-color="#fff"
				:bar-style="barStyle"
				:active-item-style="activeStyle"
				active-color="#fff"></u-tabs>
			</view>
		</view>
		<view class="banner">
			<!-- <image src="../../static/img/banner.png"></image> -->
			<u-swiper :list="bannerList" mode="none" img-mode="scaleToFill" border-radius="16"></u-swiper>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
						{
							name: '首页'
						}, 
						{
							name: '财税服务'
						}, 
						{
							name: '办公服务'
						},
						{
							name: '资质代办'
						},
						{
							name: '人事服务'
						},
						{
							name: '法律服务'
						}	
					],
					barWidth: 60,
					current: 0,
					searchWord: '',
					activeStyle:{
						fontSize: 32+'rpx',
					},
					barStyle: {
						// marginLeft:4+'rpx',
					},
					bannerList:[
						{
							image: '../../static/img/banner01.png',
							title: '身无彩凤双飞翼，心有灵犀一点通'
						},
						{
							image: '../../static/img/banner02.png',
							title: '身无彩凤双飞翼，心有灵犀一点通'
						},
						{
							image: '../../static/img/banner03.png',
							title: '身无彩凤双飞翼，心有灵犀一点通'
						},
						{
							image: '../../static/img/banner04.png',
							title: '身无彩凤双飞翼，心有灵犀一点通'
						},
						{
							image: '../../static/img/banner05.png',
							title: '身无彩凤双飞翼，心有灵犀一点通'
						}
					]
			}
		},
		methods:{
			change(index) {
				this.current = index
				console.log(this.current)
				if(this.current !== 0) {
					this.barWidth = 115
				}else {
					this.barWidth = 60
				}
				if(this.current == 4){
					uni.navigateTo({
					    url: './hrService'
					});
				}
				if(this.current == 1){
					uni.navigateTo({
					    url: './fiscalService'
					});
				}
			}
		},
	}
</script>

<style lang="scss" scoped>
	.contain{
		position: relative;
		margin-bottom: 200rpx;
		.header {
			background: #409EFF;
			height: 332rpx;
			padding-top: 66rpx;
			.search {
				height: 88rpx;
				padding-left: 34rpx;
				box-sizing: border-box;
				display: flex;
				color: #fff;
				.text {
					height: 88rpx;
					width: 96rpx;
					padding-top: 22rpx;
					box-sizing: border-box;
					.img{
						display: inline-block;
						width: 32rpx;
						height: 32rpx;
					}
				}
				.input {
					flex: 1;
					margin-top: 12rpx;
					padding-right: 40rpx;
					padding-left: 14rpx;		
				}
			}
		}
		.banner {
			position: absolute;
			width: 690rpx;
			height: 236rpx;
			left:30rpx;
			top:250rpx;
		}
	}
</style>
